<template>
  <div id="footer" v-if="tabShow">
    <tabbar style="background:rgb(39,39,39);">
      <tabbar-item :selected="select == index" :link="tab.url" v-for="(tab,index) in tabBar" :key="index">
        <img v-if="select == index" slot="icon" :src="tab.selectedIconPath">
        <img v-else slot="icon" :src="tab.iconPath">
        <span slot="label">{{tab.text}}</span>
      </tabbar-item>
    </tabbar>
  </div>
</template>

<script>
import { Tabbar, TabbarItem } from "vux";
import shouye0 from "../../images/icon_shouye01.png";
import shouye1 from "../../images/icon_shouye02.png";
import club0 from "../../images/icon_club01.png";
import club1 from "../../images/icon_club02.png";
import shuju0 from "../../images/icon_shuju01.png";
import shuju1 from "../../images/icon_shuju02.png";
import wode0 from "../../images/icon_wode01.png";
import wode1 from "../../images/icon_wode02.png";
export default {
  data() {
    return {
      tabShow: true,
      tabBar: [
        {
          url: "/home",
          iconPath: shouye0,
          selectedIconPath: shouye1,
          text: "首页"
        },
        {
          url: "/club",
          iconPath: club0,
          selectedIconPath: club1,
          text: "亲友圈"
        },
        {
          url: "/agent",
          iconPath: shuju0,
          selectedIconPath: shuju1,
          text: "代理数据"
        },
        {
          url: "/user",
          iconPath: wode0,
          selectedIconPath: wode1,
          text: "我的"
        }
      ]
    };
  },
  props: ["select"], //组件之间相互传递数据 0：首页 1：亲友圈 2：代理数据 3我的
  components: {
    Tabbar,
    TabbarItem
  }
};
</script>

<style scoped>
#footer {
  position: fixed;
  width: 100%;
  left: 0;
  bottom: 0;
}
</style>
<style>
#footer .weui-bar__item_on .weui-tabbar__label {
  color: rgb(14, 141, 236);
}
</style>



